package com.yonyou.pmclouds.workflow.service.rmiimpl;

import com.alibaba.dubbo.config.annotation.Service;
import com.yonyou.pmclouds.ApplicationConsts;
import com.yonyou.pmclouds.alterandvisa.entity.AlterAndVisaVO;
import com.yonyou.pmclouds.basecom.billstatus.BillStatusConst;
import com.yonyou.pmclouds.basecom.bp.template.SingleUpdateBpTemplate;
import com.yonyou.pmclouds.basecom.dao.BaseMapper;
import com.yonyou.pmclouds.basecom.entity.SuperVO;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.basecom.runtime.RuntimeEnvironment;
import com.yonyou.pmclouds.basecom.util.BeanHelper;
import com.yonyou.pmclouds.basecom.util.CommonFieldConst;
import com.yonyou.pmclouds.externalservice.entity.FailedExternalRecordVO;
import com.yonyou.pmclouds.externalservice.rmiitf.FailedExternalRecordMaintain;
import com.yonyou.pmclouds.externalservice.rmiitf.FailedExternalRecordQuery;
import com.yonyou.pmclouds.messagenotice.entity.MessageNoticeVO;
import com.yonyou.pmclouds.messagenotice.rmiitf.MessageNoticeMaintain;
import com.yonyou.pmclouds.project.processor.ProjectBillUpdateForUpdate;
import com.yonyou.pmclouds.task.entity.TaskVO;
import com.yonyou.pmclouds.task.rmiitf.TaskRemoteService;
import com.yonyou.pmclouds.workflow.aspect.PMApprove;
import com.yonyou.pmclouds.workflow.entity.*;
import com.yonyou.pmclouds.workflow.service.ProcessApprovalRecordService;
import com.yonyou.pmclouds.workflow.service.ProcessRuntimeService;
import com.yonyou.pmclouds.workflow.service.ProcessTaskService;
import com.yonyou.pmclouds.workflow.service.rmiitf.IFlowApprove;
import com.yonyou.pmclouds.workflow.service.rmiitf.IWorkFlowCommitService;
import com.yonyou.pmclouds.workflow.service.rmiitf.IWorkFlowService;
import com.yonyou.pmclouds.workflow.util.ApprovalFlowExecutor;
import com.yonyou.pmclouds.workflow.util.ApprovalStatusEnum;
import com.yonyou.pmclouds.workflow.util.RejectFlowExecutor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import yonyou.bpm.rest.request.RestVariable;
import yonyou.bpm.rest.request.task.TaskQueryParam;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Service(version = ApplicationConsts.APPLICATION_VERSION, interfaceClass = IWorkFlowCommitService.class, timeout = 10000)
public class WorkFlowCommitImpl implements IWorkFlowCommitService {

    @Autowired
    private IFlowApprove flowApprove;

    @Override
    @PMApprove(trigger = "commit")
    public SuperVO commit(CommitFlowParamVO approveInfoParam) throws BusinessException {
        return this.getBuziVOForWorkFlow(approveInfoParam.getPkBill(), approveInfoParam.getBillType());
    }
    public SuperVO getBuziVOForWorkFlow(String pkBill, String billType) throws BusinessException {
        return flowApprove.getBuziVOForWorkFlow(pkBill, billType);
    }
}
